package com.xxx.common.enums;

import com.xxx.common.enums.base.BaseEnum;
import lombok.Getter;

/**
 * @author Flying
 * @date 2018-08-16 17:52:35
 **/
public enum ThirdPartyType implements BaseEnum {
    /**
     * 微信
     */
    WX(1,"微信"),
    /**
     * QQ
     */
    QQ(2,"QQ"),
    /**
     * 微博
     */
    SINA(3,"新浪微博"),
    /**
     * 微信
     */
    MINIAPP(4,"小程序"),
    /**
     * 微信公众号
     */
    WECHATSUB_SCRIPTION(5, "微信公众号"),

    /**
     * APP
     */
    APP(6, "APP"),
    ;

    private final Integer value;

    private final String description;

    ThirdPartyType(Integer value, String description){
        this.value = value;
        this.description = description;
    }

    public static ThirdPartyType valueOf(Integer value) {
        for (ThirdPartyType item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public ThirdPartyType get(Integer value) {
        return ThirdPartyType.valueOf(value);
    }


    @Override
    public String toString() {
        return String.valueOf(this.value);
    }
}
